home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 11 - 1995 / 11.02 Feb 95 / Yenta / Erics C++ Libraries / Interface Classes / CPPButton.cp < prev    next >
Encoding:
Text File  |  1996-04-04  |  2.1 KB  |  88 lines  |  [TEXT/KAHL]

  1. /********************************************************* DEFINITION
  2.     DATE:    9/23/93
  3.     AUTHOR: Eric R. Rosé
  4.     
  5.     CLASS:  CPPButton
  6.     
  7.     SUPERCLASS: CPPVisualObject
  8.     
  9.         This C++ class manages a Button control
  10.     
  11. ********************************************************************/
  12.  
  13. #include <CPPButton.h>
  14.  
  15.  
  16. extern Rect kDefaultRect;
  17. extern Rect kEmptyRect;
  18.  
  19. CPPButton    *TheButton;
  20.  
  21. /*-----------------------------------------------------------------*/
  22. /*------------------------ PUBLIC METHODS -------------------------*/
  23. /*-----------------------------------------------------------------*/
  24.  
  25.     CPPButton::CPPButton (CPPWindow *itsWindow, short ResID,
  26.                               Boolean isFramed,
  27.                              Boolean canBeTarget,
  28.                              Boolean active, Boolean visible) :
  29.                 CPPControl (itsWindow, ResID, isFramed, canBeTarget, 
  30.                                  active, visible)
  31.     /* load a control resource and initialize with the given data */
  32.     {
  33.  
  34.     }
  35.  
  36. /*-----------------------------------------------------------------*/
  37.  
  38.     CPPButton::CPPButton (CPPWindow *itsWindow, Rect *itsBounds,
  39.                              StringPtr itsText,
  40.                               Boolean isFramed,
  41.                               Boolean useWindowFont,
  42.                              Boolean canBeTarget,
  43.                              Boolean active, Boolean visible) :
  44.                 CPPControl (itsWindow, itsBounds, pushButProc,
  45.                             itsText, isFramed, useWindowFont,
  46.                             canBeTarget, active, visible)
  47.     {
  48.  
  49.     }
  50.  
  51. /*-----------------------------------------------------------------*/
  52.  
  53.     CPPButton::~CPPButton (void)
  54.     {
  55.     }
  56.     
  57. /*-----------------------------------------------------------------*/
  58.  
  59.     char    *CPPButton::ClassName (void)
  60.     {
  61.         return "CPPButton";
  62.     }
  63.  
  64. /*-----------------------------------------------------------------*/
  65.  
  66.     void    CPPButton::EnableButton (Boolean nowEnabled)
  67.     /* enable or disable the button */
  68.     {
  69.         EnableControl (nowEnabled);
  70.     }
  71.  
  72. /*-----------------------------------------------------------------*/
  73.  
  74.     void    CPPButton::SimulateClick (void)
  75.     /* hilite the control as if it was clicked in */
  76.     {
  77.         long    tempLInt;
  78.         
  79.         if (this->theControl && this->IsVisible() && this->isEnabled)
  80.           {
  81.               HiliteControl (this->theControl, inButton);
  82.               Delay(6, &tempLInt);
  83.               HiliteControl (this->theControl, 0);
  84.               this->DoOnClick ();
  85.           }
  86.         
  87.     }
  88.